﻿using System;
using System.Collections.Generic;
 using UnityEngine;
using System.Text;


public class GameFacade
{

    private bool mIsGameOver = false;

    public bool isGameOver
    {
        get { return mIsGameOver; }
    }

    private GameFacade()
    {
    }

    private static GameFacade _Instance = new GameFacade();
    public static GameFacade Instance {
        get { return _Instance; }
    }
    #region //初始化
    private ArchievementSystem mArchievementSystem;
    private CampSystem mCampSystem;
    private CharacterSystem mCharacterSystem;
    private EnergySystem mEnergySystem;
    private GameEventSystem mGameEventSystem;
    private StageSystem mStageSystem;

    private CampInfoUI mCampInfoUI;
    private GamePauseUI mGamePauseUI;
    private GameStateInfoUI mGameStateInfoUI;
    private SoldierInfoUI mSoldierInfoUI;
   
    /// <summary>
    /// 初始化
    /// </summary>
    public void init()
    {
        mArchievementSystem = new ArchievementSystem();
        mCampSystem = new CampSystem();
        mCharacterSystem = new CharacterSystem();
        mEnergySystem = new EnergySystem();
        mGameEventSystem = new GameEventSystem();
        mStageSystem = new StageSystem();

        mCampInfoUI = new CampInfoUI();
        mGamePauseUI = new GamePauseUI();
        mGameStateInfoUI = new GameStateInfoUI();
        mSoldierInfoUI = new SoldierInfoUI();
    }

    /// <summary>
    /// 游戏更新
    /// </summary>
    public void update()
    {
        mArchievementSystem.Update();
        mCampSystem.Update();
        mCharacterSystem.Update();
        mEnergySystem.Update();
        mGameEventSystem.Update();
        mStageSystem.Update();

        mCampInfoUI.Update();
        mGamePauseUI.Update();
        mGameStateInfoUI.Update();
        mSoldierInfoUI.Update();
    }

    /// <summary>
    /// 游戏结束 或切换场景 回收资源
    /// </summary>
    public void Release()
    {
        mArchievementSystem.Release();
        mCampSystem.Release();
        mCharacterSystem.Release();
        mEnergySystem.Release();
        mGameEventSystem.Release();
        mStageSystem.Release();

        mCampInfoUI.Release();
        mGamePauseUI.Release();
        mGameStateInfoUI.Release();
        mSoldierInfoUI.Release();
    }
    #endregion

    public Vector3 GetEnemyTargetPosition()
    {
        //todo 关卡系统提供兵营位置
        return Vector3.zero;
    }

}

